/*     */ package com.qmsk.business.info.integralCash.dao;
/*     */ 
/*     */ import com.qmsk.business.member.member.dao.MemberDAO;
/*     */ import com.qmsk.business.member.shopMember.dao.ShopMemberDAO;
/*     */ import com.qmsk.business.sys.basic.SupportDAO;
/*     */ import com.utils.gson.in.GsonHeadOneRow;
/*     */ import com.utils.gson.out.GsonEbRst;
/*     */ import com.utils.gson.out.GsonEbUtils;
/*     */ import java.sql.SQLException;
/*     */ import java.util.HashMap;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class IntegralCashDao extends SupportDAO
/*     */ {
/*     */   public GsonEbRst getGsonOfShopId(Integer shopId, Integer nPageIdx, Short nPageSize)
/*     */     throws SQLException
/*     */   {
/*  39 */     Object[] params = { shopId };
/*  40 */     return getGsonOfParams(
/*  41 */       "selectSqlOfShopId", "selectCountSqlOfShopId", 
/*  42 */       "selectJsonOfShopId", params, nPageIdx, nPageSize);
/*     */   }
/*     */ 
/*     */   public GsonEbRst getGsonOfShopIdAndStId(Integer shopId, Integer stId) throws SQLException
/*     */   {
/*  47 */     short nSize = 1;
/*  48 */     Object[] params = { shopId, stId };
/*  49 */     return getGsonOfParams(
/*  50 */       "selectSqlOfShopIdAndstId", "selectJsonOfShopId", params, Integer.valueOf(0), 
/*  51 */       Short.valueOf(nSize));
/*     */   }
/*     */ 
/*     */   public Long selectScheduleTypeIDRep(Object stId, Object shopId) throws SQLException
/*     */   {
/*  56 */     Map params = new HashMap();
/*  57 */     params.put("shopId", shopId);
/*  58 */     params.put("stId", stId);
/*  59 */     return queryForLong("selectScheduleTypeIDRep", params, Long.valueOf(0L));
/*     */   }
/*     */ 
/*     */   public Long isExistsStIdRuleType(Object stId, Object shopId, Object ruleType, Object levelId) throws SQLException
/*     */   {
/*  64 */     Map params = new HashMap();
/*  65 */     params.put("shopId", shopId);
/*  66 */     params.put("stId", stId);
/*  67 */     params.put("ruleType", ruleType);
/*  68 */     params.put("levelId", levelId);
/*  69 */     return queryForLong("isExistsStIdRuleType", params, Long.valueOf(0L));
/*     */   }
/*     */ 
/*     */   public Long isExistsStIdRuleType_update(Object stId, Object shopId, Object ruleType, Object levelId) throws SQLException
/*     */   {
/*  74 */     Map params = new HashMap();
/*  75 */     params.put("shopId", shopId);
/*  76 */     params.put("stId", stId);
/*  77 */     params.put("ruleType", ruleType);
/*  78 */     params.put("levelId", levelId);
/*  79 */     return queryForLong("isExistsStIdRuleType_update", params, Long.valueOf(0L));
/*     */   }
/*     */ 
/*     */   public GsonEbRst getIntegralCashOfGroupCode(Integer groupCode, Integer shopId) throws SQLException
/*     */   {
/*  84 */     Object[] params = { shopId, shopId, groupCode };
/*  85 */     return getGsonOfParams(
/*  86 */       "selectSqlOfGroupCode", "selectJsonOfGroupCode", params);
/*     */   }
/*     */ 
/*     */   public GsonHeadOneRow getIntegralCashOfId(Object id) throws SQLException {
/*  90 */     Object[] params = { id };
/*  91 */     return getOneRowOfParams("selectSqlIntegralCashOfId", 
/*  92 */       "selectJsonIntegralCashOfId", params);
/*     */   }
/*     */ 
/*     */   public GsonEbRst getCashOfIntegralRatio(Object shopId, int stId, Object memberId) throws SQLException
/*     */   {
/*  97 */     Map param = new HashMap();
/*  98 */     param.put("memberId", memberId);
/*  99 */     param.put("stId", Integer.valueOf(stId));
/* 100 */     param.put("shopId", shopId);
/* 101 */     if (stId == 1) {
/* 102 */       int[] status = { 1, 
/* 103 */         2, 3, 
/* 104 */         4, 5, 
/* 105 */         6 };
/* 106 */       param.put("status", status);
/*     */     } else {
/* 108 */       param.put("status", Integer.valueOf(2));
/*     */     }
/* 110 */     MemberDAO memberdao = new MemberDAO();
/* 111 */     Integer levelId = memberdao.getLevelIdNormal(memberId, Integer.valueOf(stId));
/* 112 */     if ((levelId != null) && (levelId.intValue() > 0)) {
/* 113 */       Object[] params = { shopId, Integer.valueOf(stId), levelId };
/* 114 */       GsonEbRst g1 = getGsonOfParams("selectSqlCashOfIntegralRatioLV", 
/* 115 */         "selectJsonCashOfIntegralRatio", params);
/* 116 */       if ((g1 == null) || (!(g1.isExistsData()))) {
/* 117 */         g1 = getGsonOfParams("selectSqlCashOfIntegralRatio", 
/* 118 */           "selectJsonCashOfIntegralRatio", param);
/*     */       }
/* 120 */       GsonEbRst g2 = getGsonOfParams("selectSqlCashOfIntegralRatioLV_", 
/* 121 */         "selectJsonCashOfIntegralRatio", params);
/* 122 */       if ((g2 == null) || (!(g2.isExistsData()))) {
/* 123 */         g2 = getGsonOfParams("selectSqlCashOfIntegralRatio_", 
/* 124 */           "selectJsonCashOfIntegralRatio", param);
/*     */       }
/* 126 */       GsonEbRst gg = GsonEbUtils.toGsonEbRst(g1, g2);
/* 127 */       return gg;
/*     */     }
/* 129 */     GsonEbRst g1 = getGsonOfParams("selectSqlCashOfIntegralRatio", 
/* 130 */       "selectJsonCashOfIntegralRatio", param);
/* 131 */     GsonEbRst g2 = getGsonOfParams("selectSqlCashOfIntegralRatio_", 
/* 132 */       "selectJsonCashOfIntegralRatio", param);
/* 133 */     GsonEbRst gg = GsonEbUtils.toGsonEbRst(g1, g2);
/* 134 */     return gg;
/*     */   }
/*     */ 
/*     */   public GsonHeadOneRow getBillIntegralOfId(Object memberId, Integer stId, Long shopId)
/*     */     throws SQLException
/*     */   {
/* 140 */     Map param = new HashMap();
/* 141 */     param.put("memberId", memberId);
/* 142 */     param.put("stId", stId);
/* 143 */     param.put("shopId", shopId);
/* 144 */     if (stId.intValue() == 1) {
/* 145 */       int[] status = { 1, 
/* 146 */         2, 3, 
/* 147 */         4, 5, 
/* 148 */         6 };
/* 149 */       param.put("status", status);
/*     */     } else {
/* 151 */       param.put("status", Integer.valueOf(2));
/*     */     }
/* 153 */     ShopMemberDAO shopMemberdao = new ShopMemberDAO();
/* 154 */     Integer levelId = shopMemberdao
/* 155 */       .getLevelIdNormal(memberId, stId, shopId);
/* 156 */     if ((levelId != null) && (levelId.intValue() > 0)) {
/* 157 */       Object[] params = { shopId, levelId, memberId, stId };
/* 158 */       GsonHeadOneRow g = getOneRowOfParams("selectsqlBillIntegralOfIdLV", 
/* 159 */         params);
/* 160 */       if ((g == null) || ((g != null) && (!(g.isExistsData())))) {
/* 161 */         g = getOneRowOfParams("selectsqlBillIntegralOfId", param);
/*     */       }
/* 163 */       return g;
/*     */     }
/* 165 */     return getOneRowOfParams("selectsqlBillIntegralOfId", param);
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\新建文件夹\WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.info.integralCash.dao.IntegralCashDao
 * JD-Core Version:    0.5.3
 */